<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* var x,r,z;
        x = 100;
        y = 200;
        z = x+y;
        console.log(z)
        var str = (x==100?"成功！":"失败！")
        console.log(str)
        if(y==200){
            console.log("aaaa")
        }else{
            console.log("bbb")
        }

        for(var k=0;k<20;k++){
            console.log(k);
        }
        while(x<130){

            x++;
        }
        */

        var fun03 = ()=>{
            console.log("fun03...");
        }
       fun03();

       var funAdd = (a,b)=>{
            console.log(a+b);
        }
        funAdd(100,200);

        var funAdd01 = (a,b)=>{
            var c = a+b;
            return c;
        }
        
        var result = funAdd01(100,400);
        console.log(result);
        var objStudent = {
            name:"xm",
            age:23,
            num:1002
        }
         console.log(objStudent.name,objStudent.age);
         var funAdd03 = (a,b)=>{
            var c = a + b;
            return{
                name:"xm123",
                age:22,
                num:1012
            }
            console.log(a+b);
        }
        funAdd(100,200);

        //Math


        var num = Math.random()    //生成一个0-1之间的随机数（包含0，但不包含1）
        console.log(num)

        var num = 10.6
        console.log(Math.round(num))   //round函数：四舍五入

        var num = -10
        console.log(Math.abs(num))      //abs函数：取绝对值

        var num=10.1
        console.log(Math.ceil(num))      //ceil函数：；小数向上取整

        var num=10.9
        console.log(Math.floor(num))       //floor函数：向下取整

        console.log(Math.max(1,2,3,4,5))
        console.log(Math.min(1,2,3,4,5))
        console.log(Math.PI)                 //Math.PI:3.1415926……


       var i ;
       console.log(typeof i)
       i = "abc2023" ;
       console.log(i)
       i =199;
       console.log(typeof i)
       var x = "100";
       console.log(typeof x)
       x = Number(x)
       console.log(typeof x)

       //Date
       var time = new Date()    //新建时间默认返回当前时间
        console.log(time)

        var time2 = new Date('2019-03-03 13:11:11')    //传入字符串形式的时间
        console.log(time2)

        var time = new Date(2019,00)    //月份从0开始计数，00表示1月
        console.log(time)

        var time = new Date(2019,00,05)    //日期1—31
        console.log(time)

        var time = new Date(2019,00,05,22,33,55)    //小时0-23,分钟0-59,秒数0-59
        console.log(time)

        console.log(time2.getFullYear())       //使用getFullYear函数得到指定字符串的年份


        /*       getMount是月份
         getDate是具体日期
         getHours，getMinutes，getSeconds，
         getDay得到具体是周几0-6
         getTime
*/

//定时器
        
        var timeId = setTimeout(function(){         //setTimeout设置多长时间后执行函数
            console.log('我执行了')
            },1000)
            console.log(timeId)

       //箭头函数
       var a=11111
        var b=22222
        const fn = function (a, b) {
            console.log(a)
            console.log(b)
        }
        const fun = (a, b) => {
            console.log(a)
            console.log(b)
        }
        fn
        fun
        

        const obj__ = {
            fn: function (a, b) {
                console.log(a)
                console.log(b)
            }
        }
        const obj2 = {
            fn: (a, b) => {
                console.log(a)
                console.log(b)
            }
        }
        const obj1 = {
            fn: function () {
                console.log(this)
            },
            fun: () => {
                console.log(this)
            }
        }
        obj1.fn()
        obj1.fun()

        const obj3 = {
            fn: function () {
                console.log(arguments)
            },
            fun: () => {
                console.log(arguments)
            }
        }
        obj3.fn(1, 2, 3) 
        obj3.fun(1, 2, 3) 


    </script>
</head>
<body>
    javascript !
    <script type="text/javascript">
        alert('hello!')
    </script>
    <br>
    <div onclick="alert('我是一个弹出层')">点一下试试看</div>
    <input type="text" />
</body>
</html>